import * as types from "../action-types";
import {put, take, takeEvery, call, all, delay, fork,cancel} from '../../redux-saga/effects';


function* increment() {
    while (true) {
        yield delay(1000);
        yield put({type:types.INCREMENT})

    }

}

export function* incrementWatcher() {
    const task = yield fork(increment);
    yield take(types.STOP_INCREMENT);
    yield cancel(task)

}


export default function* () {
    yield all([incrementWatcher])
}


